package com.ym.jiujiangeyou;

import com.ym.jiujiangeyou.app.AppManager;
import com.ym.jiujiangeyou.bitmap.SimpleImageLoad;
import com.ym.jiujiangeyou.ui.ZoomImageView;
import com.ym.jiujiangeyou.util.FileManager;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.os.Bundle;
import android.widget.TextView;

/**
 * @author 叶铭
 * @email yeming_1001@163.com
 * @version V1.0
 */
public class PicDetailActivity extends Activity {

	/**
	 * 自定义的ImageView控制，可对图片进行多点触控缩放和拖动
	 */
	private ZoomImageView zoomImageView;
	private SimpleImageLoad simpleImageLoad;
	TextView title_text ;

	/**
	 * 待展示的图片
	 */
	private Bitmap bitmap;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		// 添加Activity到堆栈
				AppManager.getAppManager().addActivity(this);
		super.setContentView(R.layout.image_detail);
		zoomImageView = (ZoomImageView) findViewById(R.id.zoom_image_view);
		title_text = (TextView) findViewById(R.id.title_text) ;
		title_text.setText("图片") ;
		// 取出图片路径，并解析成Bitmap对象，然后在ZoomImageView中显示
		String imagePath = getIntent().getStringExtra("imageurl");
		System.out.println("-----------imagePath--------------"+imagePath) ;
		simpleImageLoad = new SimpleImageLoad(this);
		bitmap = BitmapFactory.decodeFile(FileManager
						.getImagePath(imagePath));
				zoomImageView.setImageBitmap(bitmap);
		
		
		
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		// 记得将Bitmap对象回收掉
		if (bitmap != null) {
			bitmap.recycle();
		}
	}

}
